<html>
<#import "/spring.ftl" as spring />
<#--<#assign url = "HTTP://192.168.15.45:8082/weike">-->
<#assign url = "http://share.waijiaojun.com:8082/weike">
<#assign ctx = request.contextPath />
<head>
    <title>register</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="keywords" content="外教君送你体验课">
    <meta name="description" content="外教君送你体验课">
    <link href="${ctx}/static/weike-share/css/style.css" rel="stylesheet">
    <script type="text/javascript" src="${ctx}/static/weike-share/js/libs/jquery-2.1.3.min.js"></script>
    <script type="text/javascript" src="${ctx}/static/weike-share/js/libs/jquery-3.1.1.min.js"></script>
    <script type="text/javascript" src="${ctx}/static/weike-share/js/libs/md5.js"></script>
</head>
<body>
<script>
    $(function () {
        $(".open_app").click(function(){
            var u = navigator.userAgent, app = navigator.appVersion;
            var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1; //android终端或者uc浏览器
            var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
            if(isAndroid==1){
                var ua = window.navigator.userAgent.toLowerCase();
                if(ua.match(/MicroMessenger/i) == 'micromessenger'){
                    $(".btn").click(function(){
                        $(".fc").removeClass("hide");

                    });
                }else{ //跳转到应用市场
                    self.location="http://a.app.qq.com/o/simple.jsp?pkgname=com.waijiaojun"
                }
            }
            else( //跳转到appstore
                    self.location="https://itunes.apple.com/cn/app/id1077827502"
            )

        });


        // 用户通过扫描二维码注册
        $("#submitbtn").click(function () {
            var val_mobil = /^(1(([3578][0-9])|(47)))\d{8}$/;
            var mobile=$("#telephoneNumber").val();
            if(mobile==""||mobile==null){alert("手机号不能为空"); return false;}
            if(mobile.match(val_mobil)==null) {
                alert("手机号码格式不正确");
                return false;
            }

            var telephoneNumber=$("#telephoneNumber").val();
            var check_clause = document.getElementById("check-btn").checked;
            if(!check_clause){
                alert("请阅读用户协议并勾选");
                return false;
            }
//            $(".fc").click(function(){
//                $(".fc").addClass("hide");
//            });

            var timestamp = Date.parse(new Date())/1000;
            var SignInfo = timestamp+"nativetalk";
            var token = hex_md5(SignInfo);
            $.ajax({
                type:'get',
                url:'${url}/v4.2/student/member/register/bycode?'+"memb_phone="+$("#telephoneNumber").val()+"&invite_code="+$("#invite_code").val()+"&memb_phone_area="+ $("#country option:selected").val(),
                dataType : 'json',
                contentType:"application/json;charset=utf-8",
                headers:{"client_type":"3","version":"10","Timestamp":timestamp,"SignInfo":token},
                success:function(data){
                    if(data.mark=="0"){
                        $(".page-one").addClass("hide");
                        $(".page-two").removeClass("hide");
                        $("#phone_number_show").html(data.obj.memb_phone);
                        $("#phone_number_show").val(data.obj.memb_phone);
                        $("#discount_coupon").val(data.obj.discountCoupon);
                        $("#subtract").val(data.obj.discountCoupon.subtract);
                    }else{
                        alert(data.tip);
                    }
                },error:function (e) {
                    console.log(e);
                    alert(e.toString());
                }
            });
        });
    });
</script>

<form id="to_reserve_form">
<#if invite_code?? && invite_code != "">
    <input type="hidden" id="invite_code" value="${invite_code}"/>
</#if>
    <div class="page-one">
        <div class="page-one-top">
            <div class="page-top-left">
                <img src="${ctx}/static/images/logo.png" alt="外教君"/>
                外教君
            </div>
            <div class="page-top-right">
                <a class="btn-warning open_app">立即打开</a>
            </div>
        </div>
        <div class="page-login">
            <p>登陆即可获得免费体验课</p>
        </div>
        <div class="from-input">
            <select id="country" name="dcf-areacodePhone">
                <option value="+1">+1</option>
                <option value="+1-242">+1-242</option>
                <option value="+1-246">+1-246</option>
                <option value="+1-264">+1-264</option>
                <option value="+1-268">+1-268</option>
                <option value="+1-284">+1-284</option>
                <option value="+1-340">+1-340</option>
                <option value="+1-345">+1-345</option>
                <option value="+1-441">+1-441</option>
                <option value="+1-473">+1-473</option>
                <option value="+1-649">+1-649</option>
                <option value="+1-664">+1-664</option>
                <option value="+1-670">+1-670</option>
                <option value="+1-671">+1-671</option>
                <option value="+1-758">+1-758</option>
                <option value="+1-767">+1-767</option>
                <option value="+1-784">+1-784</option>
                <option value="+1-787">+1-787</option>
                <option value="+1-809">+1-809</option>
                <option value="+1-868">+1-868</option>
                <option value="+1-869">+1-869</option>
                <option value="+1-876">+1-876</option>
                <option value="+20">+20</option>
                <option value="+212">+212</option>
                <option value="+213">+213</option>
                <option value="+216">+216</option>
                <option value="+218">+218</option>
                <option value="+220">+220</option>
                <option value="+221">+221</option>
                <option value="+222">+222</option>
                <option value="+223">+223</option>
                <option value="+224">+224</option>
                <option value="+225">+225</option>
                <option value="+226">+226</option>
                <option value="+227">+227</option>
                <option value="+228">+228</option>
                <option value="+229">+229</option>
                <option value="+230">+230</option>
                <option value="+231">+231</option>
                <option value="+232">+232</option>
                <option value="+233">+233</option>
                <option value="+234">+234</option>
                <option value="+235">+235</option>
                <option value="+236">+236</option>
                <option value="+237">+237</option>
                <option value="+238">+238</option>
                <option value="+239">+239</option>
                <option value="+240">+240</option>
                <option value="+241">+241</option>
                <option value="+242">+242</option>
                <option value="+243">+243</option>
                <option value="+244">+244</option>
                <option value="+245">+245</option>
                <option value="+246">+246</option>
                <option value="+248">+248</option>
                <option value="+249">+249</option>
                <option value="+250">+250</option>
                <option value="+251">+251</option>
                <option value="+252">+252</option>
                <option value="+253">+253</option>
                <option value="+254">+254</option>
                <option value="+255">+255</option>
                <option value="+256">+256</option>
                <option value="+257">+257</option>
                <option value="+258">+258</option>
                <option value="+260">+260</option>
                <option value="+261">+261</option>
                <option value="+262">+262</option>
                <option value="+263">+263</option>
                <option value="+264">+264</option>
                <option value="+265">+265</option>
                <option value="+266">+266</option>
                <option value="+267">+267</option>
                <option value="+268">+268</option>
                <option value="+269">+269</option>
                <option value="+27">+27</option>
                <option value="+290">+290</option>
                <option value="+291">+291</option>
                <option value="+297">+297</option>
                <option value="+298">+298</option>
                <option value="+299">+299</option>
                <option value="+30">+30</option>
                <option value="+31">+31</option>
                <option value="+32">+32</option>
                <option value="+33">+33</option>
                <option value="+34">+34</option>
                <option value="+350">+350</option>
                <option value="+351">+351</option>
                <option value="+352">+352</option>
                <option value="+353">+353</option>
                <option value="+354">+354</option>
                <option value="+355">+355</option>
                <option value="+356">+356</option>
                <option value="+357">+357</option>
                <option value="+358">+358</option>
                <option value="+359">+359</option>
                <option value="+36">+36</option>
                <option value="+370">+370</option>
                <option value="+371">+371</option>
                <option value="+372">+372</option>
                <option value="+373">+373</option>
                <option value="+374">+374</option>
                <option value="+375">+375</option>
                <option value="+376">+376</option>
                <option value="+377">+377</option>
                <option value="+378">+378</option>
                <option value="+380">+380</option>
                <option value="+381">+381</option>
                <option value="+382">+382</option>
                <option value="+385">+385</option>
                <option value="+386">+386</option>
                <option value="+387">+387</option>
                <option value="+389">+389</option>
                <option value="+39">+39</option>
                <option value="+40">+40</option>
                <option value="+41">+41</option>
                <option value="+420">+420</option>
                <option value="+421">+421</option>
                <option value="+423">+423</option>
                <option value="+43">+43</option>
                <option value="+44">+44</option>
                <option value="+45">+45</option>
                <option value="+46">+46</option>
                <option value="+47">+47</option>
                <option value="+48">+48</option>
                <option value="+49">+49</option>
                <option value="+500">+500</option>
                <option value="+501">+501</option>
                <option value="+502">+502</option>
                <option value="+503">+503</option>
                <option value="+504">+504</option>
                <option value="+505">+505</option>
                <option value="+506">+506</option>
                <option value="+507">+507</option>
                <option value="+508">+508</option>
                <option value="+509">+509</option>
                <option value="+51">+51</option>
                <option value="+52">+52</option>
                <option value="+53">+53</option>
                <option value="+54">+54</option>
                <option value="+55">+55</option>
                <option value="+56">+56</option>
                <option value="+57">+57</option>
                <option value="+58">+58</option>
                <option value="+590">+590</option>
                <option value="+591">+591</option>
                <option value="+592">+592</option>
                <option value="+593">+593</option>
                <option value="+594">+594</option>
                <option value="+595">+595</option>
                <option value="+596">+596</option>
                <option value="+597">+597</option>
                <option value="+598">+598</option>
                <option value="+599">+599</option>
                <option value="+60">+60</option>
                <option value="+61">+61</option>
                <option value="+62">+62</option>
                <option value="+63">+63</option>
                <option value="+64">+64</option>
                <option value="+649">+649</option>
                <option value="+65">+65</option>
                <option value="+66">+66</option>
                <option value="+670">+670</option>
                <option value="+672">+672</option>
                <option value="+673">+673</option>
                <option value="+674">+674</option>
                <option value="+675">+675</option>
                <option value="+676">+676</option>
                <option value="+677">+677</option>
                <option value="+678">+678</option>
                <option value="+679">+679</option>
                <option value="+680">+680</option>
                <option value="+681">+681</option>
                <option value="+682">+682</option>
                <option value="+683">+683</option>
                <option value="+684">+684</option>
                <option value="+685">+685</option>
                <option value="+686">+686</option>
                <option value="+687">+687</option>
                <option value="+688">+688</option>
                <option value="+689">+689</option>
                <option value="+690">+690</option>
                <option value="+691">+691</option>
                <option value="+692">+692</option>
                <option value="+7">+7</option>
                <option value="+81">+81</option>
                <option value="+82">+82</option>
                <option value="+84">+84</option>
                <option value="+850">+850</option>
                <option value="+852">+852</option>
                <option value="+853">+853</option>
                <option value="+855">+855</option>
                <option value="+856">+856</option>
                <option value="+86" selected>+86</option>
                <option value="+880">+880</option>
                <option value="+886">+886</option>
                <option value="+90">+90</option>
                <option value="+91">+91</option>
                <option value="+92">+92</option>
                <option value="+93">+93</option>
                <option value="+94">+94</option>
                <option value="+95">+95</option>
                <option value="+960">+960</option>
                <option value="+961">+961</option>
                <option value="+962">+962</option>
                <option value="+963">+963</option>
                <option value="+964">+964</option>
                <option value="+965">+965</option>
                <option value="+966">+966</option>
                <option value="+967">+967</option>
                <option value="+968">+968</option>
                <option value="+970">+970</option>
                <option value="+971">+971</option>
                <option value="+972">+972</option>
                <option value="+973">+973</option>
                <option value="+974">+974</option>
                <option value="+975">+975</option>
                <option value="+976">+976</option>
                <option value="+977">+977</option>
                <option value="+98">+98</option>
                <option value="+992">+992</option>
                <option value="+993">+993</option>
                <option value="+994">+994</option>
                <option value="+995">+995</option>
                <option value="+996">+996</option>
                <option value="+998">+998</option>
            </select>
            <input type="number" id="telephoneNumber" placeholder="请输入您的手机号">
        </div>
        <div class="queren-btn">
            <button class="btn" id="submitbtn" type="button">立即领取</button>
        </div>
        <div class="psss">
            <label class="check-btn">
                <input type="checkbox" id="check-btn" checked=""> 我已阅读外教君的<a href="http://app.a.student.nativetalk.waijiaojun.com/article/detail?arti_id=1">用户使用协议</a>
            </label>
        </div>
    </div>

</form>


<div id="show_table" class="page-two hide">
    <div class="page-one-top">
        <div class="page-top-left">
            <img src="${ctx}/static/images/logo.png" alt="外教君"/>
            外教君
        </div>
        <div class="page-top-right">
            <a class="btn-warning open_app">立即打开</a>
        </div>
    </div>
    <div class="scc">领取成功</div>
    <div class="scc-img">
        <img src="${ctx}/static/images/succeed.png" alt="成功"/>
    </div>
    <div class="account">
        课程体验券已放入你的账号：<p style="display:inline" id="phone_number_show"></p>
    </div>
    <div class="up">
        可到应用商店下载最新版【外教君】App体验
    </div>
</div>
</body>
</html>
